Correctly terminate created string. From Mark Bradley.
authorrobertl <robertl>
Tue, 14 Oct 2003 13:20:00 +0000 (13:20 +0000)
committerrobertl <robertl>
Tue, 14 Oct 2003 13:20:00 +0000 (13:20 +0000)
util.c

diff --git a/util.c b/util.c
index 5219a6606b922be616e643ea5c02d09d82c88623..de96b5959394c70aa75ae0e41b74aa24bbc8a6a9 100644 (file)
--- a/util.c
+++ b/util.c
@@ -171,7 +171,7 @@ xstrndupt(const char *str, size_t sz)
 
        newstr = xmalloc(newlen + 1);
        memcpy(newstr, str, newlen);
-       newstr[newlen+1] = '\0';
+       newstr[newlen] = '\0';
        rtrim(newstr);
 
        return newstr;